+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
+Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
+ entry->visible into editable class. (Leave it
+ behind deprecated for compatibility)
+
+ * gtk/gtkeditable.c: If not editable->visible,
+ return *'s for clipboard and selection.
+
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
static void gtk_editable_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
+static void *gtk_editable_get_public_chars (GtkEditable *editable,
+ gint start,
+ gint end);
static gint gtk_editable_selection_clear (GtkWidget *widget,
GdkEventSelection *event);
static void gtk_editable_selection_get (GtkWidget *widget,
editable->selection_end_pos = 0;
editable->has_selection = FALSE;
editable->editable = 1;
+ editable->visible = 1;
editable->clipboard_text = NULL;
#ifdef USE_XIM
return klass->get_chars (editable, start, end);
}
+/*
+ * Like gtk_editable_get_chars, but if the editable is not
+ * visible, return asterisks
+ */
+static void *
+gtk_editable_get_public_chars (GtkEditable *editable,
+ gint start,
+ gint end)
+{
+ if (editable->visible)
+ return gtk_editable_get_chars (editable, start, end);
+ else
+ {
+ gint i;
+ gint nchars = end - start;
+ gchar *str;
+
+ if (nchars < 0)
+ nchars = -nchars;
+
+ str = g_new (gchar, nchars + 1);
+ for (i = 0; i<nchars; i++)
+ str[i] = '*';
+ str[i] = '\0';
+
+ return str;
+ }
+}
+
static void
gtk_editable_set_selection (GtkEditable *editable,
gint start_pos,
{
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
- str = gtk_editable_get_chars(editable,
- selection_start_pos,
- selection_end_pos);
+ str = gtk_editable_get_public_chars(editable,
+ selection_start_pos,
+ selection_end_pos);
if (!str)
return; /* Refuse */
length = strlen (str);
if (gtk_selection_owner_set (GTK_WIDGET (editable),
clipboard_atom,
time))
- editable->clipboard_text = gtk_editable_get_chars (editable,
- selection_start_pos,
- selection_end_pos);
+ editable->clipboard_text = gtk_editable_get_public_chars (editable,
+ selection_start_pos,
+ selection_end_pos);
}
}
guint selection_end_pos;
guint has_selection : 1;
guint editable : 1;
+ guint visible : 1;
GdkIC *ic;
GdkICAttr *ic_attr;
GTK_VALUE_UINT (*arg) = entry->text_max_length;
break;
case ARG_VISIBILITY:
- GTK_VALUE_BOOL (*arg) = entry->visible;
+ GTK_VALUE_BOOL (*arg) = GTK_EDITABLE (entry)->visible;
break;
default:
arg->type = GTK_TYPE_INVALID;
g_return_if_fail (entry != NULL);
g_return_if_fail (GTK_IS_ENTRY (entry));
- entry->visible = visible;
+ entry->visible = visible ? TRUE : FALSE;
+ GTK_EDITABLE (entry)->visible = visible ? TRUE : FALSE;
gtk_entry_recompute_offsets (entry);
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
selection_end_xoffset =
entry->char_offset[selection_end_pos] -entry->scroll_offset;
- /* if entry->visible, print a bunch of stars. If not, print the standard text. */
- if (entry->visible)
+ /* if editable->visible, print a bunch of stars. If not, print the standard text. */
+ if (editable->visible)
{
toprint = entry->text + start_pos;
}
toprint + selection_end_pos - start_pos,
end_pos - selection_end_pos);
/* free the space allocated for the stars if it's neccessary. */
- if (!entry->visible)
+ if (!editable->visible)
g_free (toprint);
if (editable->editable)
for (i=start_pos; i<end_pos; i++)
{
entry->char_offset[i] = entry->char_offset[start_pos] + offset;
- if (entry->visible)
+ if (editable->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
for (i=0; i<entry->text_length; i++)
{
entry->char_offset[i] = offset;
- if (entry->visible)
+ if (GTK_EDITABLE (entry)->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
guint16 text_length; /* length in use */
guint16 text_max_length;
gint scroll_offset;
- guint visible : 1;
+ guint visible : 1; /* deprecated - see editable->visible */
guint32 timer;
guint button;